package com.fulin.leetcode;

/**
 * TODO
 *
 * @Author fulin
 * @Date 2022/9/23 13:45
 **/
public class Num190_颠倒二进制数 {
    public int reverseBits(int n) {
        int result = 0;
        while(n != 0){
            int r = n | 0;
            if(r == 0){
                result = result << 1;
            }else{
                result = (result << 1) + 1;
            }
            n = n >>> 1;
        }
        return result;
    }
}
